// pages/index/index.js
import { request } from '../../utils/request.js';

Page({/**
    * 页面的初始数据
    */
    data: {
        swiperList: [],
        categoriesList: [],
        floorList: []
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.loadSwiper();
        this.loadCate();
        this.loadFloorData();
    },
    //加载轮播图数据
    loadSwiper: function () {

        request({
            url: '/home/swiperdata'
        }).then((swiperList) => {
            this.setData({
                swiperList
            })
        })
    },

    //加载商品分类导航
    loadCate: function () {
        request({ url: '/home/catitems' }).then((categoriesList) => {
            console.log("使用封装之后的 request工具");
            this.setData({
                categoriesList
            })
        })

    },
     //加载商品分类导航
     loadFloorData: function () {
        request({ url: '/home/floordata' }).then((floorList) => {
            // console.log("使用封装之后的 request工具");
            this.setData({
                floorList
            })
        })

    }


})